// stationDlg.h : header file
//

#pragma once

#include "StationModel.h"
#include "Resource.h"
#include "afxtempl.h"
#include "SocketManage.h"
#include "AlarmModel.h"

class CAlarmLogDlg;
// CstationDlg dialog
class CstationDlg : public CDialog
{
// Construction
public:
	CstationDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_STATION_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support


// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();

	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg void OnClose();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnNMCustomdrawList1(NMHDR *pNMHDR, LRESULT *pResult);
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	CStationModel * getStationModel(){ return &stationmodel; }
	CListCtrl m_list;
	CTreeCtrl m_tree;
	CStationModel stationmodel;
	CSocketManage *psockmnger;
	CAlarmLogDlg  *  alarmlogdlg;
	BOOL checkID(const CString& sid);
	HTREEITEM addStationToTree(station & sta, HTREEITEM rooth);
	afx_msg void OnLvnItemchangedList1(NMHDR *pNMHDR, LRESULT *pResult);
	
	afx_msg void OnSelchangedTree(NMHDR *pNMHDR, LRESULT *pResult);
	
	CMap<int,int,CString,CString> treetoid;
	afx_msg void OnNMRClickTree(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnAddStation();
	afx_msg void OnDeleteStation();
	
	
	
	void notifyAlarm(ALARMITEM & alarmitem);
	void paintStationFrame(const station & sta);
	afx_msg void OnBnClickedModifyIp();
	afx_msg void OnBnClickedButton2();
};
